package com.qfedu.meidijiaju.service.impl;

import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.UserYxy;
import com.qfedu.meidijiaju.mapper.UserYxyMapper;
import com.qfedu.meidijiaju.service.UserYxyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-03
 */
@Service
public class UserYxyServiceImpl extends ServiceImpl<UserYxyMapper, UserYxy> implements UserYxyService {

    @Autowired
    private UserYxyMapper userYxyMapper;

    @Override
    public ResponseData<UserYxy> findUserByUserIdTieZi(int userId) {

        UserYxy userYxy = userYxyMapper.findUserByUserIdTieZi(userId);

        ResponseData<UserYxy> responseData = new ResponseData<>();

        if (userYxy != null){

            responseData.setCode(200);

            responseData.setData(userYxy);

        } else {

            responseData.setCode(400);

            responseData.setMsg("无该用户！");

        }

        return responseData;
    }

    @Override
    public ResponseData<UserYxy> findUserByUserIdShipu(int userId) {

        UserYxy userYxy = userYxyMapper.findUserByUserIdShipu(userId);

        ResponseData<UserYxy> responseData = new ResponseData<>();

        if (userYxy != null){

            responseData.setCode(200);

            responseData.setData(userYxy);

        } else {

            responseData.setCode(400);

            responseData.setMsg("无该用户！");

        }

        return responseData;
    }
}
